import axios from 'axios'

class IpService {
  async getCurrentIp() {
    try {
      // 使用ipify API获取当前外网IP
      const response = await axios.get('https://api.ipify.org?format=json');
      return response.data.ip;
    } catch (error) {
      console.error('获取IP地址失败:', error);
      throw error;
    }
  }
}

export default new IpService(); 